package cn.leida.ruoyi.common.core.domain;

import cn.hutool.core.date.DateUtil;
import cn.leida.ruoyi.common.utils.DateUtils;
import com.alibaba.fastjson2.JSONObject;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Entity基类
 *
 * @author ruoyi
 */
public class BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 搜索值
     */
    private String searchValue;

    private boolean requestPage = true;

    /**
     * 请求参数
     */
    private JSONObject params = new JSONObject();

    public String getSearchValue() {
        return searchValue;
    }

    public void setSearchValue(String searchValue) {
        this.searchValue = searchValue;
    }


    public JSONObject getParams() {
        if (params == null) {
            params = new JSONObject();
        }
        return params;
    }

    public void setParams(JSONObject params) {
        this.params = params;
    }

    /**
     * yyyyMMddHHmm
     */
    public String nowTime() {
        return DateUtils.dateTimeNow();
    }

    /**
     * yyyyMMddHHmm
     */
    public long nowTimeLong() {
        return Long.parseLong(nowTime());
    }

    /**
     * yyyyMMdd
     */
    public String today() {
        return DateUtil.format(new Date(), "yyyyMMdd");
    }

    /**
     * yyyyMMdd
     */
    public long todayLong() {
        return Long.parseLong(today());
    }

    public boolean isRequestPage() {
        return requestPage;
    }

    public void setRequestPage(boolean requestPage) {
        this.requestPage = requestPage;
    }

    /**
     * 显示
     */
    public void initShow() {

    }

    /**
     * 创建
     */
    public void initCreate() {

    }

    /**
     * 更新
     */
    public void initUpdate() {

    }

}
